WDV221 Intro Javascript
Unit 9 Arrays Assignment
Please complete the following exercises on this page. When complete post
this page to your server. Make a link in your WDV221 homework page for
this assignment.
Include a comment in each script with the exercise number and a
description of what the script is supposed to do.
Using Blackboard submit this Assignment.
Lookup Tax Rate Form
This form will use arrays to load the values into the drop down list. It
will allow the user to select a state from the dropdown list. Once it is
selected the tax rate for that state will be dislayed on the form.
Instructions:
-
Create an array called states that lists the following states in this
order: Iowa, Illinois, Missouri, Wisconsin
-
Create a parallel array called stateSalesTax that lists the following
values in this order: 6%,11%,7%,8%.
-
Use Javascript to dynamically load the list of states into the drop down
menu.
- Create a function called salesTaxLookup( ).
-
Use the onchange event handler on the select element to run
salesTaxLookup( )
-
The function will use a lookup loop to find where the state is located
in the states array. It can then get the corresponding tax rate from the
stateSalesTax array.
- It will display the tax rate for the selected state.
Back